package cn.woochen.functionwidget.util

/**
 * 字符串工具类
 *
 * @author woochen123
 * @time 2018/5/16 15:08
 * @desc
 */

object StringUtil {


    /**
     * 字符串部分替换为特殊符号
     */
    private fun replaceByStar(message: String, startIndex: Int, replaceNum: Int): String {
        if (message.length < 18) {
            return ""
        }
        val replaceSymbol = "*"//替换符号
        val stringBuilder = StringBuilder()
        for (i in 0 until message.length) {
            val number = message[i]
            if (i >= startIndex && i < startIndex + replaceNum) {
                stringBuilder.append(replaceSymbol)
            } else {
                stringBuilder.append(number)
            }
        }
        return stringBuilder.toString()
    }
}
